Skip to content

Add Flow types for EventPluginHub#11465

Merged
gaearon merged 2 commits intofacebook:masterfrom
dylanapplegate:add-event-plugin-hub-flow-types
Nov 15, 2017
Merged

Add Flow types for EventPluginHub#11465
gaearon merged 2 commits intofacebook:masterfrom
dylanapplegate:add-event-plugin-hub-flow-types

Conversation

@dylanapplegate
Copy link
Copy Markdown
Contributor

Added EventPluginHub Flow types. Please note, I ran into a weird bug in Flow where the order of the union types mattered. It's why one would see these sort of diffs in two of the files:

  • current: ?(T | Array),
  • current: ?(Array | T),

Tomorrow, I'll check the Flow project to see if there is already an open issue or resolution regarding the bug.

Comment thread packages/events/EventPluginHub.js Outdated
eventQueue = null;
if (simulated) {

if (simulated && processingEventQueue) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit odd. If we don't want to do anything when processingEventQueue is empty, can we exit early instead? Otherwise we're directing simulated events into non-simulated branch (even though technically there's no events) which seems wrong.

Comment thread packages/events/EventPluginHub.js Outdated
var executeDispatchesAndRelease = function(event, simulated) {
var executeDispatchesAndRelease = function(
event: ReactSyntheticEvent,
simulated,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: boolean

Comment thread packages/events/EventPluginHub.js Outdated
var executeDispatchesAndRelease = function(event, simulated) {
var executeDispatchesAndRelease = function(
event: ReactSyntheticEvent,
simulated,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

: bool

Comment thread packages/events/EventPluginHub.js Outdated
}
};
var executeDispatchesAndReleaseSimulated = function(e) {
var executeDispatchesAndReleaseSimulated = function(e: ReactSyntheticEvent) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this can be inferred? I'd prefer we annotate public APIs and low-level functions, but not all the glue code.

@gaearon
Copy link
Copy Markdown
Collaborator

gaearon commented Nov 15, 2017

I'm not very familiar with this code but as well might start learning it :-) This seems good to me. Thanks!

@gaearon gaearon merged commit 634b70a into facebook:master Nov 15, 2017
@dylanapplegate
Copy link
Copy Markdown
Contributor Author

No problem! I'll get a PR over later this week with a little more typing.

@dylanapplegate dylanapplegate deleted the add-event-plugin-hub-flow-types branch November 15, 2017 16:57
Ethan-Arrowood pushed a commit to Ethan-Arrowood/react that referenced this pull request Dec 8, 2017
* Add Flow types for EventPluginHub

* add boolean and remove extraneous typing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants